﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="RolesPage.aspx.cs" Inherits="Mani.Common.UI.RolesPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h3 class="ui-widget-header">
            <asp:Literal ID="lbtitle" runat="server" Text="مدیریت نقشها" />
    </h3>  
    
    <div class="ui-layout-content ui-widget-content">

        سیستم : &nbsp; &nbsp;
        <asp:DropDownList ID="ddlApplications" AutoPostBack="true" runat="server" 
            AppendDataBoundItems="true" DataTextField="ApplicationName" 
            DataValueField="ApplicationId" 
            onselectedindexchanged="ddlApplications_SelectedIndexChanged">
            <asp:ListItem Text="---" Value="E6ED2728-D5C7-45FC-8183-52A6C624E311" />
        </asp:DropDownList>

        <div class="space2"></div>

        <mani:PagingGridView runat="server" ID="gvRoles" Width="500" 
            AutoGenerateColumns="false" DataKeyNames="RoleId" 
            onrowcreated="gvRoles_RowCreated" onrowdeleted="gvRoles_RowDeleted" 
            onrowdeleting="gvRoles_RowDeleting" 
            onselectedindexchanging="gvRoles_SelectedIndexChanging"
            CssClass="DDGridView" RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6">
            <Columns>
                <asp:BoundField HeaderText="کد نقش" DataField="RoleId" Visible="false" />
                <asp:BoundField HeaderText="نام نقش" DataField="RoleName" />

                <asp:TemplateField>
                    <itemtemplate>
                        <asp:LinkButton ID="btnEdit" runat="server" CausesValidation="False" CommandName="Select">
                                <img src="/App_Themes/<%=Page.Theme %>/images/edit.gif" alt="" style="border:0;" />
                        </asp:LinkButton>
                    </itemtemplate>
                </asp:TemplateField>

                <asp:TemplateField>
                    <itemtemplate>
                        <asp:LinkButton ID="btnDelete" runat="server" CausesValidation="False" CommandName="Delete">
                                <img src="/App_Themes/<%=Page.Theme %>/images/delete.gif" alt="" style="border:0;" />
                        </asp:LinkButton>
                    </itemtemplate>
                </asp:TemplateField>
            </Columns>
        </mani:PagingGridView>


        <div class="space"></div>
        
        <h3 class="ui-widget-header">ایجاد و ویرایش نقش :</h3>

        <div class="space2"></div>

        <table>
            <tr>
                <td>
                    کد نقش
                </td>
                <td>
                    <asp:Label ID="lblRoleId" runat="server" Text="-" />
                </td>
            </tr>
            <tr>
                <td colspan="2">&nbsp;</td>
            </tr>
            <tr>
                <td>
                    نام نقش
                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtRoleName"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvRoleName" ControlToValidate="txtRoleName" runat="server"  ErrorMessage="*" ValidationGroup="AddEditRole" />
                </td>
            </tr>
            <tr>
                <td colspan="2">&nbsp;</td>
            </tr>
            <tr>
                <td>لیست دسترسی ها</td>
                <td>
                </td>
            </tr>
            <tr>
                <td></td>
                <td><asp:CheckBoxList ValidationGroup="AddEditRole" DataTextField="Description" DataValueField="ActionId" ID="cbRoleActions" runat="server" /></td>
            </tr>
            <tr>
                <td colspan="2">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Button ID="btnSaveChanges" Text="ذخیره تغییرات" runat="server" onclick="btnSaveChanges_Click" ValidationGroup="AddEditRole" />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
